home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / lines.bb < prev    next >
Encoding:
Text File  |  2002-04-10  |  1.2 KB  |  74 lines

  1. ;strange demo
  2. ;NO SHEEP THO' GEORGE ;)
  3. ;Copyright ⌐2000 EdzUp
  4. ;written by Ed Upton
  5.  
  6. ;adjust this for more lines
  7. Global lns=450
  8.  
  9. Graphics 640,480
  10. SetBuffer FrontBuffer()
  11.  
  12. Global r
  13. Global g
  14. Global b
  15. Global tim
  16.  
  17. ;X,Y screen coordinates
  18. ;F facing direction 
  19. ;T timer till it needs to change direction
  20. Type bit
  21.  Field x,y,f,t
  22. End Type
  23.  
  24. tim=Rnd(500)
  25. r=Rnd(255)
  26. g=Rnd(255)
  27. b=Rnd(255)
  28.  
  29. setup()
  30. While Not KeyDown(1)
  31.  update()
  32.  tim=tim-1
  33.  If tim<0
  34.   tim=500
  35.   r=Rnd(255)
  36.   g=Rnd(255)
  37.   b=Rnd(255)
  38.  EndIf
  39. Wend
  40. End
  41.  
  42. ;setup lines
  43. Function setup()
  44.  For n=0 To lns
  45.   bitz.bit=New bit
  46.   bitz\x=Rnd(640)
  47.   bitz\y=Rnd(480)
  48.   bitz\f=Rnd(3)
  49.   bitz\t=Rnd(20)
  50.  Next
  51. End Function
  52.  
  53. ;update function
  54. Function update()
  55.  For bitz.bit=Each bit
  56.   Color r,g,b
  57.   Plot bitz\x,bitz\y
  58.   bitz\t=bitz\t-1
  59.   If bitz\t<=0
  60.    bitz\f=Rnd(3)
  61.    bitz\t=Rnd(20)
  62.   EndIf
  63.   If bitz\f=0 Then bitz\y=bitz\y-1
  64.   If bitz\f=1 Then bitz\x=bitz\x+1
  65.   If bitz\f=2 Then bitz\y=bitz\y+1
  66.   If bitz\f=3 Then bitz\x=bitz\x-1
  67.   If bitz\x<0 Then bitz\x=639
  68.   If bitz\x>639 Then bitz\x=0
  69.   If bitz\y<0 Then bitz\y=479
  70.   If bitz\y>479 Then bitz\y=0
  71.   Color 255,255,255
  72.   Plot bitz\x,bitz\y
  73.  Next
  74. End Function